//
// Created by haoba on 2018/4/1.
//

#ifndef TKDATABASE_TK_JUTE_H
#define TKDATABASE_TK_JUTE_H

#include "../include/recordio.h"
#include "../../consensus/include/tk_message.h"
#include "../../consensus/include/tk_elog.h"

int gen_send_buf(char *send_buf, serializeBuff *msg, TYPE msg_type);
//serialize & deserialize tk_command
int serializeTkCommand(struct tk_command * command,serializeBuff * out);
int deserializeTkCommand(struct serializeBuff * in,struct tk_command * command);
//serialize & deserialize prepare
int serializePrepare(struct Prepare *pat,struct serializeBuff* out);
int deserializePrepare(struct serializeBuff* in,struct Prepare *pat);
//serialize & deserialize PrepareReply
int serializePrepareReply(struct PrepareReply *pat,struct serializeBuff* out);
int deserializePrepareReply(struct serializeBuff* in,struct  PrepareReply *pat);
//serialize & deserialize PreAccept
int serializePreAccept(struct PreAccept *pat,struct serializeBuff* out);
int deserializePreAccept(struct serializeBuff* in,struct PreAccept *pat);
//serialize & deserialize PreAcceptReply
int serializePreAcceptReply(struct PreAcceptReply *pat,struct serializeBuff* out);
int deserializePreAcceptReply(struct serializeBuff* in,struct PreAcceptReply *pat);
//serialize & deserialize PreAcceptOk
int serializePreAcceptOk(struct PreAcceptOk *pat,struct serializeBuff* out);
int deserializePreAcceptOk(struct serializeBuff* in,struct PreAcceptOk *pat);
//serialize & deserialize Accept
int serializeAccept(struct Accept *pat,struct serializeBuff* out);
int deserializeAccept(struct serializeBuff* in,struct Accept *pat);
//serialize & deserialize AcceptReply
int serializeAcceptReply(struct AcceptReply *pat,struct serializeBuff* out);
int deserializeAcceptReply(struct serializeBuff* in,struct AcceptReply *pat);
//serialize & deserilize Commit
int serializeCommit(struct Commit *pat,struct serializeBuff* out);
int deserializeCommit(struct serializeBuff* in,struct Commit *pat);
//serialize & deserinliz CommitShort
int serializeCommitShort(struct CommitShort *pat,struct serializeBuff* out);
int deserializeCommitShort(struct serializeBuff* in,struct CommitShort *pat);
//serialize & deserialize TryPreAccept
int serializeTryPreAccept(struct TryPreAccept *pat,struct serializeBuff* out);
int deserializeTryPreAccept(struct serializeBuff* in,struct TryPreAccept *pat);
//serialize & deserialize TryPreAcceptReply
int serializeTryPreAcceptReply(struct TryPreAcceptReply *pat,struct serializeBuff* out);
int deserializeTryPreAcceptReply(struct serializeBuff* in,struct TryPreAcceptReply *pat);
//serialize & deserialize Propose
int serializePropose(struct Propose *pat,struct serializeBuff* out);
int deserializePropose(struct serializeBuff* in,struct Propose *pat);
//serialize & deserialize ProposeReply
int serializeProposeReply(struct ProposeReply *pat,struct serializeBuff* out);
int deserializeProposeReply(struct serializeBuff* in,struct ProposeReply *pat);
//serialize & deserialize ProposeReplyTS
int serializeProposeReplyTS(struct ProposeReplyTS *pat,struct serializeBuff* out);
int deserializeProposeReplyTS(struct serializeBuff* in,struct ProposeReplyTS *pat);
//serialize & deserialize Read
int serializeRead(struct Read *pat,struct serializeBuff* out);
int deserializeRead(struct serializeBuff* in,struct Read *pat);
//serialize & deserialize ProposeAndRead
int serializeProposeAndRead(struct ProposeAndRead *pat,struct serializeBuff* out);
int deserializeProposeAndRead(struct serializeBuff* in,struct ProposeAndRead *pat);
//serialize & deserialize InstanceId
int serializeInstanceId(struct InstanceId *pat,struct serializeBuff* out);
int deserializeInstanceId(struct serializeBuff* in,struct InstanceId *pat);
//serialize & deserialize Clock
int serializeClock(struct Clock *pat,struct serializeBuff* out);
int deserializeClock(struct serializeBuff* in,struct Clock *pat);
//serialize & deserialize Beacon_msg
int serializeBeacon_msg(struct Beacon_msg *pat,struct serializeBuff* out);
int deserializeBeacon_msg(struct serializeBuff* in,struct Beacon_msg *pat);
//serialize & deserialize Beacon_msg_reply
int serializeBeacon_msg_reply(struct Beacon_msg_reply *pat,struct serializeBuff* out);
int deserializeBeacon_msg_reply(struct serializeBuff* in,struct Beacon_msg_reply *pat);
//serialize & deserialize ClientConnect
int serializeClientConnect(struct ClientConnect *pat,struct serializeBuff* out);
int deserializeClientConnect(struct serializeBuff* in,struct ClientConnect *pat);
//serialize & deserialize RegisterArgs
int serializeRegisterArgs(struct RegisterArgs *pat,struct serializeBuff* out);
int deserializeRegisterArgs(struct serializeBuff* in,struct RegisterArgs *pat);
//serialize & deserialize RegisterReply
int serializeRegisterReply(struct RegisterReply *pat,struct serializeBuff* out);
int deserializeRegisterReply(struct serializeBuff* in,struct RegisterReply *pat);
//serialize & deserialize GetLeaderArgs
int serializeGetLeaderArgs(struct GetLeaderArgs *pat,struct serializeBuff* out);
int deserializeGetLeaderArgs(struct serializeBuff* in,struct GetLeaderArgs *pat);
//serialize & deserialize GetLeaderReply
int serializeGetLeaderReply(struct GetLeaderReply *pat,struct serializeBuff* out);
int deserializeGetLeaderReply(struct serializeBuff* in,struct GetLeaderReply *pat);
//serialize & deserialize GetReplicaListArgs
int serializeGetReplicaListArgs(struct GetReplicaListArgs *pat,struct serializeBuff* out);
int deserializeGetReplicaListArgs(struct serializeBuff* in,struct GetReplicaListArgs *pat);
//serialize & deserialize GetReplicaListReply
int serializeGetReplicaListReply(struct GetReplicaListReply *pat,struct serializeBuff* out);
int deserializeGetReplicaListReply(struct serializeBuff* in,struct GetReplicaListReply *pat);
//serialize & deserialize BeTheLeaderReply
int serializeBeTheLeaderReply(struct BeTheLeaderReply *pat,struct serializeBuff* out);
int deserializeBeTheLeaderReply(struct serializeBuff* in,struct BeTheLeaderReply *pat);
//serialize & deserialize GENERAL
int serializeGENERAL(struct GENERAL *pat,struct serializeBuff* out);
int deserializeGENERAL(struct serializeBuff* in,struct GENERAL *pat);
//serialize & deserialize PackedState
int serializeState(struct tk_instance * pat,struct serializeBuff* out);
int deserializeState(struct serializeBuff * in,struct tk_instance * pat);
//serialize & deserialize PackedInstance
int serializeInstance(struct tk_instance *pat,struct serializeBuff* out);
int deserializeInstance(struct serializeBuff* in,struct tk_instance *pat);


#endif //TKDATABASE_TK_JUTE_H
